google.load("language", "1");

function Translator()
{
	this.inLang = "English";
	this.outLang = "Russian";
	this.translate = function(inId, outId)
	{
		var src_txt = $(inId).value;
		if (src_txt.length == 0)
		{
			$(outId).innerHTML = "";
			j$("#output_scroll").jScrollPane(ScrollSettings);
			return;
		}
			
		google.language.translate(src_txt, langs.codes[this.inLang], langs.codes[this.outLang], function(result) {
			if (!result.error)
			{
				$(outId).innerHTML = result.translation;
				j$("#output_scroll").jScrollPane(ScrollSettings);
			}
		});
	};
	
	this.setInLang = function(langName)
	{
		this.inLang = langName;
	}
	
	this.setOutLang = function(langName)
	{
		this.outLang = langName;
	}
	
	this.switchLangs = function()
	{
		var tmp = this.inLang
		this.inLang = this.outLang
		this.outLang = tmp;
	}
}